/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.machine.hal.devicealias.port;

import it.free.i.virtual.Identifiable;
import it.free.i.virtual.Linkable;
import it.free.i.virtual.machine.hal.DeviceAliasRuntimeException;
import it.free.i.virtual.machine.hal.devicealias.command.DeviceAliasPortCommandVerb;

import java.util.List;

import javax.management.DynamicMBean;
import javax.management.NotificationBroadcaster;
import javax.management.NotificationListener;

/**  
 * A channel is a way to communicate towards the outside world in IN or OUT mode
 * @author stefano
 */
public interface DeviceAliasPort extends DynamicMBean, NotificationListener, NotificationBroadcaster, Identifiable, Linkable, Runnable {
	
	public static final String IMPL_NAME_PROP_NAME = "devicealiasport.implementation.name";
	public static final String IMPL_CLASS_PROP_NAME = "devicealiasport.implementation.class";
	
	/**
	 * Get the name of the channel
	 * @return the name
	 */
	public String getName();
	
	/**
	 * Actually invoke the port of a device alias.
	 * Every device alias can have several ports
	 * This call can be a wrapper for a method doing a INPUT or an OUTPUT operation on òower level hardware, or delegating
	 * @param input is the list of input data object to use if the device alias port can do output
	 * @return the value read if the device alias port can do input
	 */
	public Object invoke(List<Object> input);
	
	/**
	 * Set the operational mode
	 * @param aMode is the mode to set
	 */
	public void setMode(DeviceAliasPortCommandVerb aMode);
	
	/**
	 * Get the operational mode
	 * @return the mode
	 */
	public DeviceAliasPortCommandVerb getMode();

	/**
	 * Define the paradigm whose consequence should be that every device port has a reset
	 * @throws DeviceAliasRuntimeException
	 */
	public void reset() throws DeviceAliasRuntimeException;
	
}
